<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Chart Visualization</title>
    <script src="https://cdn.jsdelivr.net/npm/@antv/g2@4.1.15/dist/g2.min.js"></script>
</head>
<body>
    <h1>Chart Visualization</h1>
    <div id="chartCanvas"></div>
    <script>
        // 准备数据
        const data = [
            { genre: 'Sports', sold: 275 },
            { genre: 'Strategy', sold: 115 },
            { genre: 'Action', sold: 120 },
            { genre: 'Shooter', sold: 350 },
            { genre: 'Other', sold: 150 },
        ];

        // 初始化图表实例
        const chart = new G2.Chart({
            container: 'chartCanvas',
            width: 600,
            height: 400
        });

        // 声明可视化
        chart
            .data(data) // 绑定数据
            .interval() // 创建一个 Interval 标记
            .position('genre*sold')
            .color("genre")

        // 渲染可视化
        chart.render();
    </script>
</body>
</html>
